#pragma once

#include "target_frame.h"
#include "twomasks.h"

class Segmentation;

namespace trm {

class reference_frame : public target_frame
{
public:
	reference_frame(segment & segm);
	~reference_frame();
	void create(direction dir, span const & computed_span);

	void become(target_frame & t); ///< t after the call becomes invalid

	bit_mask const & mask() const
		{ return segm().bit_mask(time()); }
	bit_mask const & downsampled_mask() const
		{ return _downsampled_mask.empty() ? mask() : _downsampled_mask; }

	void track_mask(twomasks & m, target_frame const & t);

private:
	using target_frame::create;
	using target_frame::swap;
	void prepare();

private:
	Segmentation *	_segmentation;
	bit_mask		_downsampled_mask;
};

} //namespace trm
